var t = require;
var e = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0}), (o.Sounds = void 0);
var n = t("Platforms");
(function (t) {
    var e,
        o,
        r,
        a = {};
    function i() {
        e && ((e = null), cc.audioEngine.stopMusic());
    }
    function s(r) {
        t.muted ||
            (e != r &&
                (i(),
                n.default.userStorage.musicOn
                    ? ((e = r), a[r] ? cc.audioEngine.playMusic(a[r], !0) : console.error("木有音乐：" + r))
                    : (o = r)));
    }
    function c() {
        n.default.userStorage.musicOn ? s(o) : ((o = e), i());
    }
    (t.init = function (t) {
        for (var e = 0, o = t; e < o.length; e++) {
            var n = o[e];
            a[n.name] = n;
        }
        c();
    }),
        (t.stopMusic = i),
        (t.playMusic = s),
        (t.pauseMusic = function () {
            e && ((r = e), cc.audioEngine.pauseMusic());
        }),
        (t.resumeMusic = function () {
            r && (cc.audioEngine.resumeMusic(), (r = null));
        }),
        (t.updateMusic = c),
        (t.playFX = function (e) {
            if (!t.muted && n.default.userStorage.soundOn)
                switch (e) {
                    case "-1":
                    case "":
                    case "0":
                        break;
                    default:
                        if (a[e]) return cc.audioEngine.playEffect(a[e], !1);
                        console.error("木有音效：" + e);
                }
        });
})(o.Sounds || (o.Sounds = {}));
